package com.aizuda.boot.modules.common.constant.enums;

/**
 * 评论类型枚举
 * 
 * @author yangshen
 * @version 1.0
 * @date 2025/5/23
 */
public enum CommentTypeEnum {
    
    /**
     * 协商评论
     */
    NEGOTIATION(0, "协商评论"),
    
    /**
     * 审批评论
     */
    APPROVAL(1, "审批评论");
    
    private final Integer value;
    private final String description;
    
    CommentTypeEnum(Integer value, String description) {
        this.value = value;
        this.description = description;
    }
    
    public Integer getValue() {
        return value;
    }
    
    public String getDescription() {
        return description;
    }
    
    /**
     * 根据值获取枚举
     */
    public static CommentTypeEnum fromValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (CommentTypeEnum type : CommentTypeEnum.values()) {
            if (type.getValue().equals(value)) {
                return type;
            }
        }
        return null;
    }
    
    /**
     * 验证评论类型是否有效
     */
    public static boolean isValid(Integer value) {
        return fromValue(value) != null;
    }
} 